package com.longxi.tianjintianbao.ui.presenter.task;

import com.longxi.tianjintianbao.ui.activity.task.TaskDetailActivity;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.base.BaseDialogFragment;
import com.longxi.tianjintianbao.ui.base.BasePresenter;
import com.longxi.tianjintianbao.ui.view.task.ITaskExplainDfgView;
import com.longxi.tianjintianbao.utils.MyUtils;

import me.drakeet.multitype.Items;
import me.drakeet.multitype.MultiTypeAdapter;

public class TaskExplainDfgPresenter extends BasePresenter<ITaskExplainDfgView> {

    private MultiTypeAdapter adapter;
    private Items items;

    public TaskExplainDfgPresenter(BaseActivity context, BaseDialogFragment dialogFragment) {
        super(context, dialogFragment);
    }

    public void setBar() {
        mDialogFragment.setTitle("无法完成原因");
        mDialogFragment.setTvLeft("返回");
        getView().getEtContent().setHint("请填写无法完成原因");
    }

    TaskDetailActivity taskDetailActivity;
    /**
     * 获取父类
     * @return
     */
    public TaskDetailActivity getTaskDetailActivity(){
        if(taskDetailActivity == null){
            return (TaskDetailActivity) mContext;
        }else{
            return taskDetailActivity;
        }
    }

    public void acceptTask(){
        String content = getView().getEtContent().getText().toString().trim();
        if("".equals(content)){
            MyUtils.showToast("请填写无法完成原因");
            return;
        }
        getTaskDetailActivity().cannotComplete(content);
    }

}
